package com.kefu.call.vo;

import javax.validation.constraints.Size;

import com.baomidou.mybatisplus.annotation.TableId;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractInsertVo;
import com.kefu.call.model.CallSipuser;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.util.List;

/**
 * @author CodeGenerator
 * @date 2022/07/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "SIP用户")
public class CallSipuserInsertVo extends AbstractInsertVo<CallSipuser> {


    @ApiModelProperty(value = "账号，9位数字，单次最大100条，前5位固定")
    private List<String> sipUsers;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "公司id",hidden = true)
    private String company;

    @ApiModelProperty(value = "账号，4位数字" ,hidden = true)
    private String sipUser;


    @ApiModelProperty(value = "虚拟密码",hidden = true)
    private String vmPassword;

    @ApiModelProperty(value = "允许",hidden = true)
    private String tollAllow;

    @ApiModelProperty(value = "账户代码",hidden = true)
    private String accountcode;

    @ApiModelProperty(value = "用户联系地址",hidden = true)
    private String userContext;

    @ApiModelProperty(value = "有效的呼叫者号码",hidden = true)
    private String effectiveCallerIdName;

    @ApiModelProperty(value = "有效的呼叫者号码",hidden = true)
    private String effectiveCallerIdNumber;

    @ApiModelProperty(value = "出站呼叫者姓名",hidden = true)
    private String outboundCallerIdName;

    @ApiModelProperty(value = "呼出号码",hidden = true)
    private String outboundCallerIdNumber;

    @ApiModelProperty(value = "呼叫组",hidden = true)
    private String callgroup;
    @ApiModelProperty(value = "呼叫组ID",hidden = true)
    private Integer callgroupid;

    @ApiModelProperty(value = "组名",hidden = true)
    private String groupname;
    @ApiModelProperty(value = "是否开启留言",hidden = true)
    private Integer voicemail;
    @ApiModelProperty(value = "是否bypass模式",hidden = true)
    private Integer bypass;
    @ApiModelProperty(value = "是否需要录音",hidden = true)
    private Integer needrecord;

    @ApiModelProperty(value = "规则",hidden = true)
    private String dialplanName;
    @ApiModelProperty(value = "是否开启转接",hidden = true)
    private Integer transferenable;

    @ApiModelProperty(value = "转接模式[all:全部转接 busy:遇忙转接 noAnswer:没有应答转接 offLine:不在线转接]",hidden = true)
    private String transfermodel;

    @ApiModelProperty(value = "转接的方式,默认走【n.lua】流程",hidden = true)
    private String transfercontent;
    @ApiModelProperty(value = "是否开启nat重写IP和端口",hidden = true)
    private Integer sipForceContact;

    @Override
    public CallSipuser convert() {
        CallSipuser info = new CallSipuser();
        info.setSipUser(sipUser);
        info.setPassword(password);
        info.setVmPassword(password);
        info.setTollAllow("domestic,international,local");
        info.setAccountcode(sipUser);
        info.setUserContext("default");
        info.setEffectiveCallerIdName(sipUser);
        info.setEffectiveCallerIdNumber(sipUser);
        info.setOutboundCallerIdName(sipUser);
        info.setOutboundCallerIdNumber(sipUser);
        info.setCallgroup("管理员");
        info.setCallgroupid(1);
        info.setGroupname("客服");
        info.setVoicemail(0);
        info.setBypass(0);
        info.setNeedrecord(0);
        info.setDialplanName("0");
        info.setTransferenable(0);
        info.setTransfermodel("all");
        info.setTransfercontent("n.lua");
        info.setSipForceContact(null);
        info.setCompany(company);
        return info;
    }
}